                                        <div class="box border green">
                                            <div class="box-title">
                                                <h4><i class="fa fa-bars"></i>角色编辑</h4>
                                                <div class="tools hidden-xs">
                                                    <a href="#box-config" data-toggle="modal" class="config">
                                                        <i class="fa fa-cog"></i>
                                                    </a>
                                                    <a href="javascript:;" class="reload">
                                                        <i class="fa fa-refresh"></i>
                                                    </a>
                                                    <a >
                                                        <i class="fa fa-chevron-up"></i>
                                                    </a>
                                                    <a href="javascript:;" class="remove">
                                                        <i class="fa fa-times"></i>
                                                    </a>
                                                </div>
                                            </div>
                                            <div class="box-body big">
                                                <form class="form-horizontal" role="form" action="" method="post">
                                                  <div class="form-group">
                                                    <label class="col-sm-1 control-label">角色名称</label>
                                                    <div class="col-sm-6">
                                                      <input class="form-control" id="focusedInput" type="text" value="<?php echo $db['name'];?>" name="username" placeholder="角色名称"  >
                                                    </div>
                                                  </div>
                                                  <div class="form-group">
                                                    <label class="col-sm-1 control-label" >角色权限</label>
                                                        <div class="box border green col-sm-5" style="float:left;margin-left:150px;">
                                                            <div class="box-title">
                                                                    <h4><i class="fa fa-bars"></i>权限</h4>
                                                                    <div class="tools hidden-xs">
                                                                        <a href="#box-config" data-toggle="modal" class="config">
                                                                            <i class="fa fa-cog"></i>
                                                                        </a>
                                                                        <a href="javascript:;" class="reload">
                                                                            <i class="fa fa-refresh"></i>
                                                                        </a>
                                                                        <a>
                                                                            <i class="fa fa-chevron-up"></i>
                                                                        </a>
                                                                        <a href="javascript:;" class="remove">
                                                                            <i class="fa fa-times"></i>
                                                                        </a>
                                                                      </div>

                                                              </div>

                                                              <?php foreach($date as $k => $v){?>
                                                                <table class="table table-hover">
                                                                            <thead>
                                                                                <tr>
                                                                                    <th><input name="child[]" type="checkbox" class="all" style="vertical-align: middle;margin-bottom:8px;margin-right:4px" value="<?php echo $v['id'];?>" <?php echo (in_array($v['id'],$power))?"checked":" ";?> ><?php echo $v['name']?></th>
                                                                                </tr>
                                                                            </thead>
                                                                            <tbody>
                                                                            <tr>
                                                                                <?php foreach($datea as $key => $value){?>
                                                                                      <?php if($v['id']==$value['pid']){ ?>

 <td style="float:left;margin-left:16px;"><input name="child[]" value="<?php echo $value['id'];?>"  <?php echo (in_array($value['id'],$power))?"checked":" ";?> class="jj" type="checkbox" style="vertical-align: middle;margin-bottom:8px;margin-right:4px;"><?php echo $value['name']?></td>
 <?php }?>

<?php }?>
                                                                            </tr>

                                                                            </tbody>
                                                                  </table>
                                                               <?php }?>
                                                              <div class="box-body big">

                                                                </div>
                                                         </div>
                                                  </div>
                                                  <div class="form-group">
                                                    <label class="col-sm-1 control-label" >是否启用</label>
                                                      <label class="radio-inline"><span><input type="radio" name="yes" value=1 <?php echo($status)?"checked":"";?>>是</span></label>
                                                      <label class="radio-inline"><span><input type="radio" name="yes" value=0 <?php echo ($status)?"":"checked";?>>否</span></label>

                                                  </div>

                                                   <div class="col-sm-offset-1 col-sm-10">
                                                   <button type="submit" class="btn btn-pink" >提交</button>
                                                   </div>

                                                 </form>
                                            </div>
                                        </div>
<script src="resources/admin/js/jquery/jquery-2.0.3.min.js"></script>
  <script>
      $(function(){
          /*点击全选*/
          $('.all').click(function(){

            $(this).parents('table').find('.jj').prop('checked',this.checked);

          })

          /*点击子级*/
          $('.jj').click(function(){

              /*获取子集长度*/
             var len = $(this).parents('tr').find('.jj:checked').length;

            if(len>0){
                  $(this).parents('table').find('.all').prop('checked',true);
                  }else{$(this).parents('table').find('.all').prop('checked',false);}
          })

           $(':submit').click(function(){
            var name =$('[name=username]').val();

            var check =$(':checkbox:checked').length;

            var checka =$('[name=yes]:checked').length;

            if(name==0||check==0||checka==0){
                alert("请完善角色信息！");
                return false;
            }else{
              return true;
            }
          })


      })

  </script>